namespace Management.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class CreateConnToEquipmentFile : DbMigration
    {
        public override void Up()
        {
            AddColumn("dbo.EquipmentFiles", "EquipmentAreaID", c => c.Int(nullable: true));
            AddColumn("dbo.EquipmentFiles", "AdministrationAreaID", c => c.Int(nullable: true));
            CreateIndex("dbo.EquipmentFiles", "EquipmentAreaID");
            CreateIndex("dbo.EquipmentFiles", "AdministrationAreaID");
            AddForeignKey("dbo.EquipmentFiles", "AdministrationAreaID", "dbo.AdministrationAreas", "AdministrationAreaID", cascadeDelete: true);
            AddForeignKey("dbo.EquipmentFiles", "EquipmentAreaID", "dbo.EquipmentAreas", "EquipmentAreaID", cascadeDelete: true);
            DropColumn("dbo.EquipmentFiles", "AreaID");
        }
        
        public override void Down()
        {
            AddColumn("dbo.EquipmentFiles", "AreaID", c => c.Int(nullable: false));
            DropForeignKey("dbo.EquipmentFiles", "EquipmentAreaID", "dbo.EquipmentAreas");
            DropForeignKey("dbo.EquipmentFiles", "AdministrationAreaID", "dbo.AdministrationAreas");
            DropIndex("dbo.EquipmentFiles", new[] { "AdministrationAreaID" });
            DropIndex("dbo.EquipmentFiles", new[] { "EquipmentAreaID" });
            DropColumn("dbo.EquipmentFiles", "AdministrationAreaID");
            DropColumn("dbo.EquipmentFiles", "EquipmentAreaID");
        }
    }
}
